Skip to content

Switch between phone and wide layouts by window size on iOS (iPhone Duo) - #1745

Merged
SpikeViper merged 1 commit into
fix/xcode-27-runnersfrom
feature/adaptive-layout
Nov 6, 2026
Merged

SpikeViper merged 1 commit into
fix/xcode-27-runnersfrom
feature/adaptive-layout

Conversation

@SpikeViper

Copy link
Copy Markdown
Member

Stacked on #1743, which has the iOS scene life cycle fix the app needs to launch with the iOS 27 SDK.

The iPhone and iPad app now choose between the phone and wide layouts from the window size instead of the user agent. The wide layout needs at least 680×500 points, which roughly matches iOS regular width and height size classes. The app switches live when the window crosses that line, such as when an iPhone Duo opens or closes or an iPad enters Split View or Stage Manager. Browsers, desktop and Android keep the startup check.

How the switch works: valourLayout in main.js watches a media query and reports a change after 250 ms, so the fold animation doesn't flip-flop. DeviceInfo.SetMobileLayout raises LayoutModeChanged. Index saves the dock layout, removes the shell for one render so the old dock is disposed before the new one registers as the main dock, and renders it again. The existing restore code rebuilds the windows; the phone layout keeps only the focused tab. The launch route isn't reopened. Components keep reading DeviceInfo.IsMobile when they are created.

The iOS shell also stays inside the left and right safe areas. Folded, the Duo moves the status bar into an 84pt rail on the right edge (WebKit reports it as safe-area-inset-right), and the top bar was drawing under it. The same padding covers the camera housing on iPhones in landscape.

Index now implements IDisposable. It had a Dispose method that Blazor never called, so its event subscriptions leaked.

Tested on the iPhone Duo simulator (Xcode 27.1, iOS 27.1) against a local server, with a temporary probe that reported window size, insets and layout:

  • Folded: 466×678 pt, phone layout, right inset 84, top bar clear of the rail.
  • Unfolded: 951×669 pt, wide layout with sidebar, tabs and chat, windows restored.
  • Folded and unfolded repeatedly: the layout switched correctly each time.

Not tested: iPad Split View, and an iPhone in landscape (it should stay on the phone layout, since its height is under 500 pt).

The iPhone and iPad app now pick the layout from the window size (at least
680x500 points for the wide layout, roughly iOS regular size classes) instead
of the user agent, and switch live when the window crosses that line, such as
when an iPhone Duo opens or closes or an iPad enters Split View. Index saves
the dock layout, drops the shell for one render so the old dock is disposed,
and rebuilds it in the new layout. Other hosts keep the startup check.

The iOS shell also stays inside the left and right safe areas, which keeps it
clear of the iPhone Duo status bar rail and the camera housing in landscape.
Index now implements IDisposable so its event subscriptions are removed.
@SpikeViper
SpikeViper requested a review from a team as a code owner November 6, 2026 01:02
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying valour-marketing with  Cloudflare Pages  Cloudflare Pages

Latest commit: 811085e
Status: ✅  Deploy successful!
Preview URL: https://17cb4351.valour-marketing.pages.dev
Branch Preview URL: https://feature-adaptive-layout.valour-marketing.pages.dev

View logs

@SpikeViper
SpikeViper merged commit 3b744d9 into fix/xcode-27-runners Nov 6, 2026
1 check passed
@SpikeViper
SpikeViper deleted the feature/adaptive-layout branch November 6, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant